﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FactoryMode.Calculator
{
    /// <summary>
    /// 计算操作类扩展
    /// </summary>
    internal static class OperationExtension
    {
        /// <summary>
        /// 根据操作的字符串获得操作的枚举类型
        /// </summary>
        /// <param name="operationStr"></param>
        /// <returns></returns>
       internal static OperationType GetOperationType(this string operationStr)
        {
            switch (operationStr)
            {
                case "+":
                    return OperationType.Addition;
                case "-":
                    return OperationType.Subtraction;
                case "*":
                    return OperationType.Multiplication;
                case "/":
                    return OperationType.Division;
                default:
                    return OperationType.Unknow;
            }
        }
    }
}
